from flask_login import current_user
from flask_restful import Resource, marshal_with
from libs.login import login_required
from services.role_service import RoleService
from fields.roles.menu_fields_def import menu_fields
from controllers.mini_app import api
class GetUserInfoApi(Resource):
    @login_required
    def get(self):
        return RoleService.get_user_info(current_user.current_tenant_id,current_user.id)
    
class GetUserRoutersApi(Resource):
    @login_required
    # @marshal_with(menu_fields)
    def get(self):
        return RoleService.get_user_routers(current_user.current_tenant_id,current_user.id)
    
api.add_resource(GetUserInfoApi, '/user/info')
api.add_resource(GetUserRoutersApi, '/user/routers')